package org.xxpay.pay.channel.tfpay;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * @author: pangxiaoyu
 * @date: 26/04/20
 * @description: 支付宝转账
 */
@Component
public class TfpayConfig {

    public static final String CHANNEL_NAME = "tfpay";
    public static final String CHANNEL_NAME_TFPAY_ALIPAY = CHANNEL_NAME + "_alipay";

    public static final Long PAY_ORDER_TIME_OUT = 6 * 60l;        // 订单超时时间，单位秒

    public static final String RESPONSE_RESULT_SUCCESS = "success"; // 返回上游成功
    public static final String RESPONSE_RESULT_FAIL = "fail";       // 返回上游失败

    // 账号
    private String account;
    // 姓名
    private String accountName;

    public TfpayConfig(){}

    public TfpayConfig(String payParam) {
        Assert.notNull(payParam, "init tfpay config error");
        JSONObject object = JSONObject.parseObject(payParam);
        this.account = object.getString("account");
        this.accountName = object.getString("accountName");
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }
}
